package com.css.fxfzaqbz.modules.domain.controller;

import com.css.fxfzaqbz.base.response.RestResponse;
import com.css.fxfzaqbz.modules.domain.service.AnalysisService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 单个安保活动-辅助分析对策
 */
@RestController
@RequestMapping("/fxfzaqbz/domain")
@Slf4j
public class AnalysisController {
    @Resource
    AnalysisService analysisService;
    /**
     * 根据 iaId 查询辅助分析数据-已提交
     * @param iaId 活动id
     * @return 辅助分析数据
     */
    @GetMapping("/getFzByIaId/{iaId}")
    public RestResponse getFzByIaId(@PathVariable String iaId) {
        RestResponse restResponse = null;
        try {
            restResponse = RestResponse.succeed(analysisService.getFzByIaId(iaId));
        } catch (Exception e) {
            log.error("查询辅助分析数据失败!", e);
            restResponse = RestResponse.fail("查询辅助分析数据失败");
        }
        return restResponse;
    }

    /**
     * 根据 iaId 查询处置要点分析数据-已提交
     * @param iaId 活动id
     * @return 处置要点分析数据
     */
    @GetMapping("/getCzByIaId/{iaId}")
    public RestResponse getCzByIaId(@PathVariable String iaId) {
        RestResponse restResponse = null;
        try {
            restResponse = RestResponse.succeed(analysisService.getCzByIaId(iaId));
        } catch (Exception e) {
            log.error("查询处置要点分析数据失败!", e);
            restResponse = RestResponse.fail("查询处置要点分析数据失败");
        }
        return restResponse;
    }
}
